<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>入职登记</title>
    <link rel="stylesheet" href="__CDN__/assets/salary/css/all.min.css">
    <script type="text/javascript" src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="__CDN__/assets/js/layer/layer.js"></script>
    <style>
        * {margin:0;padding:0;box-sizing:border-box;}
body {min-height:100vh;background:linear-gradient(135deg,#9bdff6 0%,#439cff 100%);display:flex;justify-content:center;align-items:center;font-family:"PingFang SC","Microsoft YaHei",sans-serif;}
.logo {position:absolute;top:20px;left:20px;}
.logo img {width:150px;height:auto;}
.container {width:100%;max-width:1200px;display:flex;justify-content:space-between;align-items:center;padding:20px;}
.left-side {flex:1;max-width:600px;}
.left-side img {width:100%;height:auto;}
.form-container {width:400px;background:rgba(255,255,255,0.8);padding:30px;border-radius:12px;box-shadow:0 0 20px rgba(255,255,255,0.3);margin-left:40px;backdrop-filter:blur(10px);}
.form-title {text-align:center;font-size:24px;margin-bottom:30px;color:#333;}
.form-group {margin-bottom:20px;position:relative;}
.form-group i {position:absolute;left:12px;top:50%;transform:translateY(-50%);color:#999;font-size:18px;}
.form-group input {width:100%;padding:12px 12px 12px 40px;border:1px solid #ddd;border-radius:6px;font-size:14px;outline:none;transition:all 0.3s ease;}
.form-group input:focus {border-color:#439cff;box-shadow:0 0 0 2px rgba(67,156,255,0.2);}
.verify-group {display:flex;gap:10px;}
.verify-group input {flex:1;}
.verify-btn {width:120px;padding:12px;background:#439cff;color:white;border:none;border-radius:6px;cursor:pointer;transition:all 0.3s ease;font-size:14px;position:relative;overflow:hidden;}
.verify-btn:hover {background:#3288e0;}
.verify-btn:active {transform:translateY(1px);}
.verify-btn.disabled {background:#ccc;cursor:not-allowed;}
.verify-btn.disabled:hover {background:#ccc;}
.verify-btn.counting {background:#f0f0f0;color:#666;}
.verify-btn.counting:hover {background:#f0f0f0;}
.submit-btn {width:100%;padding:12px;background:#439cff;color:white;border:none;border-radius:6px;font-size:16px;cursor:pointer;transition:all 0.3s ease;}
.submit-btn:hover {background:#3288e0;transform:translateY(-1px);}
.submit-btn:active {transform:translateY(1px);}
input::placeholder {color:#999;}
@media (max-width:768px) {.container {flex-direction:column;}
.form-container {margin-left:0;margin-top:20px;width:100%;max-width:400px;}
.logo {position:absolute;top:80px;left:50%;margin-left:-75px;}
.left-side{ display:none;}
}

    </style>
</head>
<body>
    <div class="logo">
        <img src="__CDN__/assets/salary/img/logo1.png" alt="公司logo">
    </div>
    
    <div class="container">
        <div class="left-side">
            <img src="__CDN__/assets/salary/img/zuoce.png" alt="左侧图片">
        </div>
        
        <div class="form-container">
            <h2 class="form-title">入职办理</h2>
            <form>
                <div class="form-group">
                    <i class="fas fa-mobile-alt"></i>
                    <input type="tel" id="mobile" placeholder="请输入手机号" >
                </div>
                <div class="form-group verify-group">
                    <div style="position: relative; flex: 1;">
                        <i class="fas fa-shield-alt"></i>
                        <input type="text" id="code" placeholder="请输入验证码" >
                    </div>
                    <button type="button" class="verify-btn" id="verifyBtn">获取验证码</button>
                </div>
                <button type="button" id="submit" class="submit-btn">办理</button>
            </form>
        </div>
    </div>

    <script>
    $(function() {

        const verifyBtn = document.getElementById('verifyBtn');
        let counting = false;
        let countDown = 60;

        verifyBtn.addEventListener('click', function() {
            if (counting) return;
            
            // 验证手机号
            const phoneInput = document.querySelector('input[type="tel"]');
            const phoneNumber = phoneInput.value.trim();
            if (!/^1[3-9]\d{9}$/.test(phoneNumber)) {
                layer.msg('请输入正确的手机号码');
                return;
            }

            counting = true;
            verifyBtn.classList.add('counting');
            
            let timer = setInterval(() => {
                countDown--;
                verifyBtn.textContent = `${countDown}秒后重试`;
                
                if (countDown <= 0) {
                    clearInterval(timer);
                    verifyBtn.textContent = '获取验证码';
                    verifyBtn.classList.remove('counting');
                    counting = false;
                    countDown = 60;
                }
            }, 1000);


            $.post("{:url('index/sendcode')}", {mobile:phoneNumber}, function(res) {
                layer.msg(res.msg);
            }, 'json');

        });

        var status = 1;
        $('#submit').click(function() {
            var mobile = $('#mobile').val();
            var code = $('#code').val();

            if (status == 0) {
                return false;
            }
            status = 0;

            $.post("{:url('index/register')}", {mobile:mobile,code:code}, function(res) {
                status = 1;
                if (res.code == 1) {
                    layer.msg(res.msg);
                } else if (res.code == 0) {
                    if (res.data.idcard) {
                        window.location.href="{:url('index/lookuserinfo')}";
                    } else {
                        window.location.href="{:url('index/saveuserinfo')}";
                    }
                }
            }, 'json');
        });

    });
    </script>
</body>
</html>